home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MIDICraft's MIDINET CD-ROM
/
MIDICraft's MIDINET CD-ROM.iso
/
DOSUTILS
/
MIDIFADE.DOC
< prev
next >
Wrap
Text File
|
1996-10-05
|
8KB
|
210 lines
******************************
MIDIFADE v1.2
fade in/out of midi binaries
by Guenter Nagler
1996
(gnagler@ihm.tu-graz.ac.at)
******************************
[0] FEATURES
+ reads a binary midi file (version 0, 1)
+ writes a binary midi file
+ fadein: increases volume in given time to a given level
+ fadeout: decreases volume in given time to a given level
+ velocity changes by percent of original velocity
+ shows length of song (time and midi units)
+ shows length of tracks (seperated parts where notes are playing)
[1] BACKGROUND
All good midi files should have a fantastic intro and a good
ending. One effect that is often used by musicians is fading.
It produces a soft start and end of a song.
Only few sequencers support fade in/out of songs.
My keyboard sequencer has ability to manually play more louder
but automatic fading is not available.
This encouraged me to write a utility that fades a midisong
at given time and velocity parameters.
It is a new challenge for me to handle midi tempo commands
even when it changes anytime in any track.
[2] FILES DESCRIPTION
MIDIFADE.EXE.........converter program
MIDIFADE.DOC.........this file, showing usage of MIDIFADE.EXE
MIDIIO.HPP...........header file for a c++ midi parser
MIDIIO.CPP...........source code for a c++ midi parser
MIDIFADE.CPP.........c++ source code for midi to text
MIDIFADE.MAK.........make file for project
MIDIFADE.CFG.........compiler options for make
MIDIFADE.PRJ.........compiler project for borland c++ compilers
only MIDIFADE.EXE is required to run program
[3] COPYRIGHT
MIDIFADE (c) 1996 was created by Guenter Nagler.
MIDIFADE is free and may be used as you wish with this one exception:
You may NOT charge any fee or derive any profit for distribution
of MIDIFADE. Thus, you may NOT sell or bundle MIDIFADE with any
product in a retail environment (shareware disk distribution, CD-ROM,
etc.) without permission of the author.
You may give MIDIFADE to your friends, upload it to a BBS, or ftp it to
another internet site, as long as you don't charge anything for it.
[4] DISCLAIMER
MIDIFADE handles 100% compatible midi files of formats 0 (one multichannel
track) or format 1 (several single channel track with leading nonchannel
track). The program will produce a binary midi of same format including
additional volume commands to fade parts of the midi file linear.
I give no guarantees of the results, especially with non 100%
compatible midi files.
If you find a midi file that you think to be 100% compatible midi
that is not correctly converted, please send a sample file to
gnagler@ihm.tu-graz.ac.at .
Use MIDIFADE at your own risk. Anything you do with MIDIFADE is your
responsibility, and not the author's. Any damage caused to any person,
computer, software, hardware, company, or business by running MIDIFADE
is your responsibility, and the author will not be liable.
If you don't understand these terms, or are not sure of something, or
are afraid something bad might come of using MIDIFADE, don't use it!
You are here forewarned.
Warning:
Always keep the original midi file until you are sure that
the resulting midi file is what you expected. The fade operation
cannot be undone!
[5] INSTALLATION
[MSDOS]
Simply copy MIDIFADE.EXE in a directory that is in your path.
When you start the program without arguments
C:\> MIDIFADE
[UNIX]
compile sources with your C++ compiler (e.g. GNU Compiler g++):
g++ -o midifade midifade.cpp midiio.cpp
and run program
$ midifade
you should get the usage text (see next section)
[6] USAGE
usage: MIDIFADE [options] midifile.mid midifade.mid
The parts in brackets [...] are optional.
options:
-time show time table where notes are played
-songtime show time of whole song only
-channel # # fade only these channels # # (1-16)
-sv # start velocity percentage (0-100)
-ev # end velocity percentage (0-100)
-st # start time
-et # end time
-fadein same as -sv 0 -ev 100 -st 0:0
-fadeout same as -sv 100 -ev 0 no -et (end of song)
accepted time formats are:
mm:ss[.microseconds] or #u in midi units or #b in beats
If option -time is specified the program does not produce an output
file (need not specify output filename).
In this case valuable information is printed that helps
finding unit and time positions of note playing sections.
It shows start and end time of song.
Alternate time formats can be used to enter start and end of fade time:
a) mm:ss[.microseconds] as e.g. 1:30 or 2:59.500000
where mm is minute value (0-70)
ss is second value (0-59)
microseconds value (0-999999, default is 0)
b) #b number of beats (same as quarternotes) from beginning of song
e.g. 123b 0b 93B
c) #u number of midi time units from the beginning of song
e.g. 24960u 0u 34115U
The number of units per beat can be found in midi file header
(mostly 96 or 192) using MIDI2TXT.
By default all channels that contain note commands are effected
by fading (only in given range start time - end time).
With option -channel one or more channels (between 1 and 16) can
be chosen that should be faded.
E.g. -channel 1 5 10 will fade only notes played on this channels
Options -sv and -ev start percentage and end percentage of note velocities.
If the value of -sv option is smaller than value of -ev we speak of "fade in"
otherwise it is called "fade out".
Options -st and -et set range of affected notes. Two time values
are given where time value of -et must be greater than -st that any
fade can be applied to notes.
Have a look at examples in [9].
[8] SUGGESTIONS / COMMENTS / BUG REPORTS / QUESTIONS
WWW: http://hgiicm.tu-graz.ac.at/Cpub
contains all my dos/unix midi programs
EMAIL: gnagler@ihm.tu-graz.ac.at
[9] USE
e.g. fade-in from start 10 seconds long:
midifade -fadein -et 0:10 original.mid fadein.mid
e.g. fade-out 10 seconds before end of midi file
hint: first show song time to be able to specify
a good -st value
midifade -time original.mid
song: units 384 - 54144 time 0:02.448768 - 5:45.276288
midifade -fadeout -st 5:35.276288 original.mid fadeout.mid
Hint: you can write -st 5:35 if the time need not be exact to
microseconds steps.
e.g. fade-in drums between certain time
midifade -channel 10 -st 0:35 -et 0.53 -sv 10 -ev 120 original.mid fadein.mid
It is allowed to use percentage values for -sv and -ev option that are
greater than 100. The original velocity will increase in this range, but
never will exceed the range 0-127.
[10] CHANGES
v1.0 to v1.1:
* multiplication overflow bug fixed
* velocity changes relative to original velocity to keep the mix
of track volumes (instead of replacing velocity values).
v1.1 to v1.2:
* used updated midiio
* added error messages for different types of errors (file not found,
invalid time range, ...)
* default -st set to start of song
* default -et set to end of song
* new option -songtime for getting time of whole song only
* new option -fadein as shortcut for fadein from start of song
is same as using options -sv 0 -ev 100 -st 0:0
(only need to use -et to set end time e.g. -et 0:10 for
10 seconds fadein)
* new option -fadeout as shortcut for fadeout till end of song
is same as using options -sv 100 -ev 0 and default value for
-et option (that is end of song)
(only need to use -st to set start time of fade out)